import { showToast } from "utils/index";
Component({
  options: {
    styleIsolation: "apply-shared",
  },
  properties: {
    info: {
      type: Object,
      value: {},
    },
    lyric: {
      type: String,
      value: "",
    },
  },

  data: {
    downloadTypes: [
      { type: 1, text: "标准音质(2.6MB)" },
      { type: 2, text: "HQ高音质(9.6MB)" },
      { type: 3, text: "SQ无损标准音质(29.7MB)" },
    ],
    showDownloadPopup: false,
    showRatioPopoup: false,
    isRotate: true,
    min: "0.5",
    max: "2.0",
    playRatio: "1.0",
    percentage: "0",
    seledType: 1,
  },
  attached() {
    const { playRatio, max, min } = this.data;
    this.setData({
      percentage: ((playRatio - min) / (max - min)) * 100 + "%",
    });
  },
  methods: {
    openRatioPopup() {
      this.setData({
        showRatioPopoup: true,
      });
    },
    openDownloadPopup() {
      this.setData({
        showDownloadPopup: true,
      });
    },
    toggleRotate(e) {
      this.setData({
        isRotate: !this.data.isRotate,
      });
    },
    onSliderChanging(e) {
      const { value } = e.detail;
      const { min, max } = this.data;
      this.setData({
        percentage: ((value - min) / (max - min)) * 100 + "%",
        playRatio: value.toFixed(1),
      });
    },
    changeDownloadType(e) {
      const { type } = e.currentTarget.dataset;
      this.setData({
        seledType: type,
      });
    },
    onConfirm() {
      console.log("点击了确定----");
    },
  },
});
